<!--
 * @Author: Aaron
 * @Date: 2021-08-25 17:42:11
 * @LastEditors: Aaron
 * @LastEditTime: 2022-03-23 11:34:40
 * @Description: file content
 * @FilePath: \ias_ui\src\views\part\record.vue
 * @Company: 沃尔玛
-->
<template>
  <el-popover v-model="recordShow" placement="bottom" title="商品数据记录" trigger="click">
    <div style="width: 400px; height: 400px; overflow: auto">
      <el-timeline>
        <el-timeline-item v-for="(record, index) in recordList" :key="index" :timestamp="parseTime(record.createdTime)" placement="top">
          <span v-if="record.recordType === 101">采购导入新增</span>
          <span v-if="record.recordType === 102">供应商提交数据</span>
          <span v-if="record.recordType === 103">供应商撤回</span>
          <span v-if="record.recordType === 104">采购页面新增</span>
          <span v-if="record.recordType === 105">采购初审</span>
          <span v-if="record.recordType === 106">采购提交审核</span>
          <span v-if="record.recordType === 107">BPMS状态同步</span>
          <span v-if="record.recordType === 108">二次校验失败</span>
          <span v-if="record.recordType === 109">发送Item file出号邮件</span>
          <span v-if="record.recordType === 110">MDA审核</span>
          <span v-if="record.recordType === 111">Item file审核</span>
          <span v-if="record.recordType === 112">采购发起激活</span>
          <span v-if="record.recordType === 113">采购发起转类型</span>
          <span v-if="record.recordType === 114">MDA自定义邮件发送</span>
          <span v-if="record.recordType === 115">MDA审核超期第一次提醒</span>
          <span v-if="record.recordType === 116">MDA审核超期第二次提醒</span>
          <span v-if="record.recordType === 117">商品出号</span>
          <span v-if="record.recordType === -100">商品删除</span>
          <span v-if="record.recordType === 118">新品委员会审核</span>
          <span v-if="record.recordType === 119">{{ record.recordMessage }}</span>
          <span v-if="record.recordType === 200">OIF单个建品</span>
          <span v-if="record.recordType === 201">HOST&nbsp;>&nbsp;{{ record.recordMessage }}</span>
          <span v-if="record.auditType === '1'" style="color: green">&nbsp;通过</span>
          <span v-if="record.auditType === '2'" style="color: #fc1111">&nbsp;拒绝：{{ record.recordMessage }}</span>
          <span>&nbsp;{{ record.createdBy }}</span>
        </el-timeline-item>
      </el-timeline>
    </div>
    <el-button slot="reference" size="mini" type="primary" @click="showRecord">查看记录</el-button>
  </el-popover>
</template>

<script>
import { queryRcordList } from '@/api/api'
import { parseTime } from '@/utils/index'

export default {
  props: {
    oid: {
      type: String,
      default: null
    }
  },
  data() {
    return {
      recordShow: false,
      recordList: []
    }
  },
  methods: {
    parseTime,
    showRecord() {
      queryRcordList(this.oid).then(
        (res) => {
          this.recordShow = true
          this.recordList = res
        },
        (error) => {
          console.log(error)
        }
      )
    }
  }
}
</script>

<style>
.el-drawer.rtl {
  overflow: scroll;
}
</style>
